cleaned up LLUICtrlFactory...

removed redundant functionality
moved buildPanel to LLPanel
master
Richard Nelson 2010-08-16 15:00:51 -07:00
parent 94e406157d
commit c20bd2dfee
62 changed files with 351 additions and 415 deletions

View File

@ -89,7 +89,7 @@ LLAccordionCtrl::LLAccordionCtrl() : LLPanel()
mSingleExpansion = false; mSingleExpansion = false;
mFitParent = false; mFitParent = false;
LLUICtrlFactory::getInstance()->buildPanel(this, "accordion_parent.xml"); buildPanel(this, "accordion_parent.xml");
} }
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------

View File

@ -41,6 +41,7 @@
#include "llfontgl.h" #include "llfontgl.h"
#include "llrect.h" #include "llrect.h"
#include "llerror.h" #include "llerror.h"
#include "lldir.h"
#include "lltimer.h" #include "lltimer.h"
#include "llaccordionctrltab.h" #include "llaccordionctrltab.h"
@ -58,6 +59,8 @@
#include "lltabcontainer.h" #include "lltabcontainer.h"
static LLDefaultChildRegistry::Register<LLPanel> r1("panel", &LLPanel::fromXML); static LLDefaultChildRegistry::Register<LLPanel> r1("panel", &LLPanel::fromXML);
LLPanel::factory_stack_t LLPanel::sFactoryStack;
// Compiler optimization, generate extern template // Compiler optimization, generate extern template
template class LLPanel* LLView::getChild<class LLPanel>( template class LLPanel* LLView::getChild<class LLPanel>(
@ -400,7 +403,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_
if (!panelp) if (!panelp)
{ {
panelp = LLUICtrlFactory::getInstance()->createFactoryPanel(name); panelp = createFactoryPanel(name);
llassert(panelp); llassert(panelp);
if (!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 // factory panels may have registered their own factory maps
if (!panelp->getFactoryMap().empty()) 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 // for local registry callbacks; define in constructor, referenced in XUI or postBuild
panelp->mCommitCallbackRegistrar.pushScope(); panelp->mCommitCallbackRegistrar.pushScope();
panelp->mEnableCallbackRegistrar.pushScope(); panelp->mEnableCallbackRegistrar.pushScope();
panelp->initPanelXML(node, parent, output_node); panelp->initPanelXML(node, parent, output_node, LLUICtrlFactory::getDefaultParams<LLPanel>());
panelp->mCommitCallbackRegistrar.popScope(); panelp->mCommitCallbackRegistrar.popScope();
panelp->mEnableCallbackRegistrar.popScope(); panelp->mEnableCallbackRegistrar.popScope();
if (!panelp->getFactoryMap().empty()) if (!panelp->getFactoryMap().empty())
{ {
LLUICtrlFactory::instance().popFactoryFunctions(); sFactoryStack.pop_back();
} }
return panelp; 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_EXTERNAL_PANEL_LOAD("Load Extern Panel Reference");
static LLFastTimer::DeclareTimer FTM_PANEL_POSTBUILD("Panel PostBuild"); 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); Params params(default_params);
{ {
LLFastTimer timer(FTM_PANEL_SETUP); LLFastTimer timer(FTM_PANEL_SETUP);
@ -965,3 +966,89 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::
return mVisibleSignal->connect(cb); 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);
}

View File

@ -110,7 +110,10 @@ protected:
LLPanel(const LLPanel::Params& params = getDefaultParams()); LLPanel(const LLPanel::Params& params = getDefaultParams());
public: 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(); /*virtual*/ ~LLPanel();
// LLView interface // LLView interface
@ -163,7 +166,7 @@ public:
EnableCallbackRegistry::ScopedRegistrar& getEnableCallbackRegistrar() { return mEnableCallbackRegistrar; } EnableCallbackRegistry::ScopedRegistrar& getEnableCallbackRegistrar() { return mEnableCallbackRegistrar; }
void initFromParams(const Params& p); 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); bool hasString(const std::string& name);
std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const; 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 // for setting the xml filename when building panel in context dependent cases
std::string mXMLFilename; std::string mXMLFilename;
typedef std::deque<const LLCallbackMap::map_t*> factory_stack_t;
static factory_stack_t sFactoryStack;
}; // end class LLPanel }; // end class LLPanel
// Build time optimization, generate once in .cpp file // 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; const std::string& name, BOOL recurse) const;
#endif #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 #endif

View File

@ -241,6 +241,7 @@ class LLTextBase
public: public:
friend class LLTextSegment; friend class LLTextSegment;
friend class LLNormalTextSegment; friend class LLNormalTextSegment;
friend class LLUICtrlFactory;
struct LineSpacingParams : public LLInitParam::Choice<LineSpacingParams> struct LineSpacingParams : public LLInitParam::Choice<LineSpacingParams>
{ {

View File

@ -218,7 +218,7 @@ bool LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen
{ {
if (!floaterp->getFactoryMap().empty()) 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 // 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()) if (!floaterp->getFactoryMap().empty())
{ {
mFactoryStack.pop_front(); LLPanel::sFactoryStack.pop_front();
} }
} }
popFileName(); popFileName();
@ -250,69 +250,6 @@ S32 LLUICtrlFactory::saveToXML(LLView* viewp, const std::string& filename)
return 0; 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; 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() std::string LLUICtrlFactory::getCurFileName()
{ {
return mFileNames.empty() ? "" : gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + mFileNames.back(); return mFileNames.empty() ? "" : gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + mFileNames.back();
@ -383,36 +297,6 @@ void LLUICtrlFactory::popFileName()
mFileNames.pop_back(); 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 //static
void LLUICtrlFactory::setCtrlParent(LLView* view, LLView* parent, S32 tab_group) 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); 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 //static
void LLUICtrlFactory::copyName(LLXMLNodePtr src, LLXMLNodePtr dest) void LLUICtrlFactory::copyName(LLXMLNodePtr src, LLXMLNodePtr dest)
{ {
dest->setName(src->getName()->mString); 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 // adds a widget and its param block to various registries
//static //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 // associate parameter block type with template .xml file
std::string* existing_tag = LLWidgetNameRegistry::instance().getValue(param_block_type); 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); 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 //FIXME: comment this in when working on schema generation
//LLWidgetTypeRegistry::instance().defaultRegistrar().add(tag, widget_type); //LLWidgetTypeRegistry::instance().defaultRegistrar().add(tag, widget_type);
//LLDefaultParamBlockRegistry::instance().defaultRegistrar().add(widget_type, &getEmptyParamBlock<T>); //LLDefaultParamBlockRegistry::instance().defaultRegistrar().add(widget_type, &get_empty_param_block<T>);
}
//static
dummy_widget_creator_func_t* LLUICtrlFactory::getDefaultWidgetFunc(const std::type_info* widget_type)
{
return LLDefaultWidgetRegistry::instance().getValue(widget_type);
} }
//static //static

View File

@ -33,24 +33,14 @@
#ifndef LLUICTRLFACTORY_H #ifndef LLUICTRLFACTORY_H
#define LLUICTRLFACTORY_H #define LLUICTRLFACTORY_H
#include "llcallbackmap.h" #include "llfasttimer.h"
#include "llinitparam.h" #include "llinitparam.h"
#include "llregistry.h" #include "llregistry.h"
#include "v4color.h"
#include "llfasttimer.h"
#include "llxuiparser.h" #include "llxuiparser.h"
#include <boost/function.hpp>
#include <iosfwd>
#include <stack>
#include <set>
class LLPanel;
class LLFloater; class LLFloater;
class LLView; class LLView;
// sort functor for typeid maps // sort functor for typeid maps
struct LLCompareTypeID struct LLCompareTypeID
{ {
@ -91,12 +81,6 @@ class LLWidgetNameRegistry
: public LLRegistrySingleton<const std::type_info*, std::string, LLWidgetNameRegistry , LLCompareTypeID> : 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 // lookup function for generating empty param block by widget type
// this is used for schema generation // this is used for schema generation
//typedef const LLInitParam::BaseBlock& (*empty_param_block_func_t)(); //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 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 // Does what you want for LLFloaters and LLPanels
// Returns 0 on success // Returns 0 on success
S32 saveToXML(LLView* viewp, const std::string& filename); S32 saveToXML(LLView* viewp, const std::string& filename);
// filename tracking for debugging info
std::string getCurFileName(); std::string getCurFileName();
void pushFileName(const std::string& name); void pushFileName(const std::string& name);
void popFileName(); 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> template<typename T>
static T* createWidget(const typename T::Params& params, LLView* parent = NULL) static T* createWidget(const typename T::Params& params, LLView* parent = NULL)
{ {
@ -192,12 +169,10 @@ public:
//return NULL; //return NULL;
} }
{ { LLFastTimer _(FTM_WIDGET_CONSTRUCTION);
LLFastTimer timer(FTM_WIDGET_CONSTRUCTION);
widget = new T(params); widget = new T(params);
} }
{ { LLFastTimer _(FTM_INIT_FROM_PARAMS);
LLFastTimer timer(FTM_INIT_FROM_PARAMS);
widget->initFromParams(params); widget->initFromParams(params);
} }
@ -272,17 +247,9 @@ fail:
template<class T> template<class T>
static T* getDefaultWidget(const std::string& name) static T* getDefaultWidget(const std::string& name)
{ {
dummy_widget_creator_func_t* dummy_func = getDefaultWidgetFunc(&typeid(T)); T::Params widget_params;
return dummy_func ? dynamic_cast<T*>((*dummy_func)(name)) : NULL; widget_params.name = name;
} return create<T>(widget_params);
template <class T>
static LLView* createDefaultWidget(const std::string& name)
{
typename T::Params params;
params.name(name);
return create<T>(params);
} }
static void copyName(LLXMLNodePtr src, LLXMLNodePtr dest); static void copyName(LLXMLNodePtr src, LLXMLNodePtr dest);
@ -335,12 +302,9 @@ fail:
static void loadWidgetTemplate(const std::string& widget_tag, LLInitParam::BaseBlock& block); static void loadWidgetTemplate(const std::string& widget_tag, LLInitParam::BaseBlock& block);
// helper function for adding widget type info to various registries // 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: 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); static const std::string* getWidgetTag(const std::type_info* widget_type);
// this exists to get around dependency on llview // this exists to get around dependency on llview
@ -349,20 +313,10 @@ private:
// Avoid directly using LLUI and LLDir in the template code // Avoid directly using LLUI and LLDir in the template code
static std::string findSkinnedFilename(const std::string& filename); static std::string findSkinnedFilename(const std::string& filename);
typedef std::deque<const LLCallbackMap::map_t*> factory_stack_t; class LLPanel* mDummyPanel;
factory_stack_t mFactoryStack;
LLPanel* mDummyPanel;
std::vector<std::string> mFileNames; 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 // this is here to make gcc happy with reference to LLUICtrlFactory
template<typename DERIVED> template<typename DERIVED>
template<typename T> 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) : LLChildRegistry<DERIVED>::StaticRegistrar(tag, func.empty() ? (LLWidgetCreatorFunc)&LLUICtrlFactory::defaultBuilder<T> : func)
{ {
// add this widget to various registries // 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 // since registry_t depends on T, do this in line here
// TODO: uncomment this for schema generation // 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()); //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 #endif //LLUICTRLFACTORY_H

View File

@ -1698,7 +1698,9 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse) const
child = getDefaultWidget<LLView>(name); child = getDefaultWidget<LLView>(name);
if (!child) if (!child)
{ {
child = LLUICtrlFactory::createDefaultWidget<LLView>(name); LLView::Params view_params;
view_params.name = name;
child = LLUICtrlFactory::create<LLView>(view_params);
} }
} }
return child; return child;

View File

@ -200,8 +200,6 @@ LLAgent::LLAgent() :
mbFlagsDirty(FALSE), mbFlagsDirty(FALSE),
mbFlagsNeedReset(FALSE), mbFlagsNeedReset(FALSE),
mbJump(FALSE),
mAutoPilot(FALSE), mAutoPilot(FALSE),
mAutoPilotFlyOnStop(FALSE), mAutoPilotFlyOnStop(FALSE),
mAutoPilotTargetGlobal(), mAutoPilotTargetGlobal(),
@ -561,6 +559,9 @@ void LLAgent::toggleFlying()
{ {
BOOL fly = !gAgent.getFlying(); BOOL fly = !gAgent.getFlying();
gAgent.mMoveTimer.reset();
LLFirstUse::notMoving(false);
gAgent.setFlying( fly ); gAgent.setFlying( fly );
gAgentCamera.resetView(); gAgentCamera.resetView();
} }
@ -2987,12 +2988,6 @@ void LLAgent::processScriptControlChange(LLMessageSystem *msg, void **)
total_count++; total_count++;
} }
} }
// Any control taken? If so, might be first time.
//if (total_count > 0)
//{
//LLFirstUse::useOverrideKeys();
//}
} }
else else
{ {

View File

@ -363,14 +363,6 @@ public:
private: private:
BOOL mIsBusy; BOOL mIsBusy;
//--------------------------------------------------------------------
// Jump
//--------------------------------------------------------------------
public:
BOOL getJump() const { return mbJump; }
private:
BOOL mbJump;
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// Grab // Grab
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View File

@ -367,19 +367,19 @@ bool create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* base)
if(gAgent.isInGroup(match_id, TRUE)) 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.group_id = match_id;
icon_params.rect = LLRect(0, 16, 16, 0); icon_params.rect = LLRect(0, 16, 16, 0);
icon_params.visible = true; icon_params.visible = true;
icon = LLUICtrlFactory::instance().createWidget<LLGroupIconCtrl>(icon_params); icon = LLUICtrlFactory::instance().create<LLGroupIconCtrl>(icon_params);
} }
else else
{ {
LLAvatarIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLAvatarIconCtrl>(); LLAvatarIconCtrl::Params icon_params;
icon_params.avatar_id = match_id; icon_params.avatar_id = match_id;
icon_params.rect = LLRect(0, 16, 16, 0); icon_params.rect = LLRect(0, 16, 16, 0);
icon_params.visible = true; icon_params.visible = true;
icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params); icon = LLUICtrlFactory::instance().create<LLAvatarIconCtrl>(icon_params);
} }
LLInlineViewSegment::Params params; LLInlineViewSegment::Params params;

View File

@ -498,7 +498,7 @@ LLAvalineListItem::LLAvalineListItem(bool hide_number/* = true*/) : LLAvatarList
, mIsHideNumber(hide_number) , mIsHideNumber(hide_number)
{ {
// should not use buildPanel from the base class to ensure LLAvalineListItem::postBuild is called. // 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() BOOL LLAvalineListItem::postBuild()

View File

@ -75,7 +75,7 @@ LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/)
{ {
if (not_from_ui_factory) 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 // *NOTE: mantipov: do not use any member here. They can be uninitialized here in case instance
// is created from the UICtrlFactory // is created from the UICtrlFactory

View File

@ -112,14 +112,14 @@ public:
mGesturePanel(NULL) mGesturePanel(NULL)
{ {
mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, 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 // Necessary for focus movement among child controls
setFocusRoot(TRUE); setFocusRoot(TRUE);
} }
BOOL postBuild() BOOL postBuild()
{ {
mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar"); mNearbyChatBar = findChild<LLNearbyChatBar>("chat_bar");
mGesturePanel = getChild<LLPanel>("gesture_panel"); mGesturePanel = getChild<LLPanel>("gesture_panel");
// Hide "show_nearby_chat" button // Hide "show_nearby_chat" button
@ -163,7 +163,7 @@ LLBottomTray::LLBottomTray(const LLSD&)
mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); 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)); 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()); mBottomTrayContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_bottomtray.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
gMenuHolder->addChild(mBottomTrayContextMenu); gMenuHolder->addChild(mBottomTrayContextMenu);
mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar"); mNearbyChatBar = findChild<LLNearbyChatBar>("chat_bar");
LLHints::registerHintTarget("nearby_chat_bar", mNearbyChatBar->LLView::getHandle());
mToolbarStack = getChild<LLLayoutStack>("toolbar_stack"); mToolbarStack = getChild<LLLayoutStack>("toolbar_stack");
mMovementButton = getChild<LLButton>("movement_btn"); mMovementButton = getChild<LLButton>("movement_btn");

View File

@ -147,7 +147,7 @@ BOOL LLCallFloater::postBuild()
childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this)); childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this));
mNonAvatarCaller = getChild<LLNonAvatarCaller>("non_avatar_caller"); mNonAvatarCaller = findChild<LLNonAvatarCaller>("non_avatar_caller");
mNonAvatarCaller->setVisible(FALSE); mNonAvatarCaller->setVisible(FALSE);
LLView *anchor_panel = LLBottomTray::getInstance()->getChild<LLView>("speak_flyout_btn"); LLView *anchor_panel = LLBottomTray::getInstance()->getChild<LLView>("speak_flyout_btn");

View File

@ -107,7 +107,7 @@ public:
static LLChatHistoryHeader* createInstance(const std::string& file_name) static LLChatHistoryHeader* createInstance(const std::string& file_name)
{ {
LLChatHistoryHeader* pInstance = new LLChatHistoryHeader; LLChatHistoryHeader* pInstance = new LLChatHistoryHeader;
LLUICtrlFactory::getInstance()->buildPanel(pInstance, file_name); buildPanel(pInstance, file_name);
return pInstance; return pInstance;
} }
@ -402,7 +402,7 @@ protected:
return; return;
} }
LLTextBase* name = getChild<LLTextBase>("user_name"); LLTextBox* name = getChild<LLTextBox>("user_name");
LLRect sticky_rect = name->getRect(); LLRect sticky_rect = name->getRect();
S32 icon_x = llmin(sticky_rect.mLeft + name->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3); 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 ) ; sInfoCtrl->setOrigin(icon_x, sticky_rect.getCenterY() - sInfoCtrl->getRect().getHeight() / 2 ) ;

View File

@ -57,7 +57,7 @@ static const S32 msg_height_pad = 5;
LLNearbyChatToastPanel* LLNearbyChatToastPanel::createInstance() LLNearbyChatToastPanel* LLNearbyChatToastPanel::createInstance()
{ {
LLNearbyChatToastPanel* item = new LLNearbyChatToastPanel(); LLNearbyChatToastPanel* item = new LLNearbyChatToastPanel();
LLUICtrlFactory::getInstance()->buildPanel(item, "panel_chat_item.xml"); buildPanel(item, "panel_chat_item.xml");
item->setFollows(FOLLOWS_NONE); item->setFollows(FOLLOWS_NONE);
return item; return item;
} }

View File

@ -351,7 +351,7 @@ BOOL LLFloaterCamera::postBuild()
setTitleVisible(TRUE); // restore title visibility after chrome applying setTitleVisible(TRUE); // restore title visibility after chrome applying
mRotate = getChild<LLJoystickCameraRotate>(ORBIT); mRotate = getChild<LLJoystickCameraRotate>(ORBIT);
mZoom = getChild<LLPanelCameraZoom>(ZOOM); mZoom = findChild<LLPanelCameraZoom>(ZOOM);
mTrack = getChild<LLJoystickCameraTrack>(PAN); mTrack = getChild<LLJoystickCameraTrack>(PAN);
assignButton2Mode(CAMERA_CTRL_MODE_MODES, "avatarview_btn"); assignButton2Mode(CAMERA_CTRL_MODE_MODES, "avatarview_btn");

View File

@ -60,7 +60,7 @@ LLFloaterInventory::~LLFloaterInventory()
BOOL LLFloaterInventory::postBuild() BOOL LLFloaterInventory::postBuild()
{ {
mPanelMainInventory = getChild<LLPanelMainInventory>("Inventory Panel"); mPanelMainInventory = findChild<LLPanelMainInventory>("Inventory Panel");
return TRUE; return TRUE;
} }

View File

@ -65,7 +65,7 @@ LLNotificationChannelPanel::LLNotificationChannelPanel(const std::string& channe
mChannelRejectsPtr = LLNotificationChannelPtr( mChannelRejectsPtr = LLNotificationChannelPtr(
LLNotificationChannel::buildChannel(channel_name + "rejects", mChannelPtr->getParentChannelName(), LLNotificationChannel::buildChannel(channel_name + "rejects", mChannelPtr->getParentChannelName(),
!boost::bind(mChannelPtr->getFilter(), _1))); !boost::bind(mChannelPtr->getFilter(), _1)));
LLUICtrlFactory::instance().buildPanel(this, "panel_notifications_channel.xml"); buildPanel(this, "panel_notifications_channel.xml");
} }
BOOL LLNotificationChannelPanel::postBuild() BOOL LLNotificationChannelPanel::postBuild()

View File

@ -180,32 +180,32 @@ BOOL LLFloaterRegionInfo::postBuild()
mInfoPanels.push_back(panel); mInfoPanels.push_back(panel);
panel->getCommitCallbackRegistrar().add("RegionInfo.ManageTelehub", boost::bind(&LLPanelRegionInfo::onClickManageTelehub, 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)); mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true));
panel = new LLPanelRegionDebugInfo; panel = new LLPanelRegionDebugInfo;
mInfoPanels.push_back(panel); mInfoPanels.push_back(panel);
LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_debug.xml"); buildPanel(panel, "panel_region_debug.xml");
mTab->addTabPanel(panel); mTab->addTabPanel(panel);
panel = new LLPanelRegionTextureInfo; panel = new LLPanelRegionTextureInfo;
mInfoPanels.push_back(panel); mInfoPanels.push_back(panel);
LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_texture.xml"); buildPanel(panel, "panel_region_texture.xml");
mTab->addTabPanel(panel); mTab->addTabPanel(panel);
panel = new LLPanelRegionTerrainInfo; panel = new LLPanelRegionTerrainInfo;
mInfoPanels.push_back(panel); mInfoPanels.push_back(panel);
LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_terrain.xml"); buildPanel(panel, "panel_region_terrain.xml");
mTab->addTabPanel(panel); mTab->addTabPanel(panel);
panel = new LLPanelEstateInfo; panel = new LLPanelEstateInfo;
mInfoPanels.push_back(panel); mInfoPanels.push_back(panel);
LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_estate.xml"); buildPanel(panel, "panel_region_estate.xml");
mTab->addTabPanel(panel); mTab->addTabPanel(panel);
panel = new LLPanelEstateCovenant; panel = new LLPanelEstateCovenant;
mInfoPanels.push_back(panel); mInfoPanels.push_back(panel);
LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_covenant.xml"); buildPanel(panel, "panel_region_covenant.xml");
mTab->addTabPanel(panel); mTab->addTabPanel(panel);
gMessageSystem->setHandlerFunc( gMessageSystem->setHandlerFunc(

View File

@ -121,7 +121,7 @@ BOOL LLFloaterScriptLimits::postBuild()
LLPanelScriptLimitsRegionMemory* panel_memory; LLPanelScriptLimitsRegionMemory* panel_memory;
panel_memory = new LLPanelScriptLimitsRegionMemory; panel_memory = new LLPanelScriptLimitsRegionMemory;
mInfoPanels.push_back(panel_memory); 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); mTab->addTabPanel(panel_memory);
} }
@ -130,7 +130,7 @@ BOOL LLFloaterScriptLimits::postBuild()
{ {
LLPanelScriptLimitsAttachment* panel_attachments = new LLPanelScriptLimitsAttachment; LLPanelScriptLimitsAttachment* panel_attachments = new LLPanelScriptLimitsAttachment;
mInfoPanels.push_back(panel_attachments); 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); mTab->addTabPanel(panel_attachments);
} }

View File

@ -891,7 +891,7 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save)
if (save) if (save)
{ {
LLXMLNodePtr panel_write = new LLXMLNode(); 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()) if (!panel_write->isNull())
{ {
@ -905,7 +905,7 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save)
} }
else else
{ {
LLUICtrlFactory::getInstance()->buildPanel(panel, path); // build it buildPanel(panel, path); // build it
LLRect new_size = panel->getRect(); // get its rectangle 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 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 (*floaterp)->setTitle(path); // use the file name as its title, since panels have no guaranteed meaningful name attribute

View File

@ -289,7 +289,7 @@ mGroupNameBox(NULL),
mInfoBtn(NULL), mInfoBtn(NULL),
mGroupID(LLUUID::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, // Remember group icon width including its padding from the name text box,
// so that we can hide and show the icon again later. // so that we can hide and show the icon again later.

View File

@ -56,7 +56,7 @@ const S32 HUD_ARROW_SIZE = 32;
LLHUDView::LLHUDView(const LLRect& r) LLHUDView::LLHUDView(const LLRect& r)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_hud.xml"); buildPanel(this, "panel_hud.xml");
setShape(r, true); setShape(r, true);
} }

View File

@ -100,9 +100,9 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
if(gAgent.isInGroup(session_id, TRUE)) 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_params.group_id = session_id;
icon = LLUICtrlFactory::instance().createWidget<LLGroupIconCtrl>(icon_params); icon = LLUICtrlFactory::instance().create<LLGroupIconCtrl>(icon_params);
mSessions[session_id] = floaterp; mSessions[session_id] = floaterp;
floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); 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); 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_params.avatar_id = avatar_id;
icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params); icon = LLUICtrlFactory::instance().create<LLAvatarIconCtrl>(icon_params);
mSessions[session_id] = floaterp; mSessions[session_id] = floaterp;
floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id));

View File

@ -307,7 +307,9 @@ LLPanelInventoryListItemBase::LLPanelInventoryListItemBase(LLViewerInventoryItem
} }
else 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); LLTextBox::Params text_params(params.item_name);
@ -320,7 +322,9 @@ LLPanelInventoryListItemBase::LLPanelInventoryListItemBase(LLViewerInventoryItem
} }
else 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);
} }
} }

View File

@ -703,7 +703,7 @@ void LLPanelStandStopFlying::reparent(LLFloaterMove* move_view)
LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel() LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel()
{ {
LLPanelStandStopFlying* panel = new LLPanelStandStopFlying(); LLPanelStandStopFlying* panel = new LLPanelStandStopFlying();
LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_stand_stop_flying.xml"); buildPanel(panel, "panel_stand_stop_flying.xml");
panel->setVisible(FALSE); panel->setVisible(FALSE);
//LLUI::getRootView()->addChild(panel); //LLUI::getRootView()->addChild(panel);
@ -716,6 +716,8 @@ LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel()
void LLPanelStandStopFlying::onStandButtonClick() void LLPanelStandStopFlying::onStandButtonClick()
{ {
LLFirstUse::sit(false);
LLSelectMgr::getInstance()->deselectAllForStandingUp(); LLSelectMgr::getInstance()->deselectAllForStandingUp();
gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);

View File

@ -278,7 +278,7 @@ LLNavigationBar::LLNavigationBar()
mPurgeTPHistoryItems(false), mPurgeTPHistoryItems(false),
mSaveToLocationHistory(false) mSaveToLocationHistory(false)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_navigation_bar.xml"); buildPanel(this, "panel_navigation_bar.xml");
// set a listener function for LoginComplete event // set a listener function for LoginComplete event
LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLNavigationBar::handleLoginComplete, this)); LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLNavigationBar::handleLoginComplete, this));

View File

@ -39,6 +39,7 @@
#include "llchatitemscontainerctrl.h" #include "llchatitemscontainerctrl.h"
#include "llfirstuse.h" #include "llfirstuse.h"
#include "llfloaterscriptdebug.h" #include "llfloaterscriptdebug.h"
#include "llhints.h"
#include "llnearbychat.h" #include "llnearbychat.h"
#include "llrecentpeople.h" #include "llrecentpeople.h"
@ -62,7 +63,13 @@ LLToastPanelBase* createToastPanel()
class LLNearbyChatScreenChannel: public LLScreenChannelBase class LLNearbyChatScreenChannel: public LLScreenChannelBase
{ {
public: 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 addNotification (LLSD& notification);
void arrangeToasts (); void arrangeToasts ();
@ -82,15 +89,12 @@ public:
} }
// hide all toasts from screen, but not remove them from a channel // hide all toasts from screen, but not remove them from a channel
virtual void hideToastsFromScreen()
{
};
// removes all toasts from a channel // removes all toasts from a channel
virtual void removeToastsFromChannel() 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(); m_active_toasts.clear();
}; };
@ -105,10 +109,11 @@ public:
protected: protected:
void addToToastPool(LLToast* toast) void addToToastPool(LLToast* toast)
{ {
if (!toast) return;
toast->setVisible(FALSE); toast->setVisible(FALSE);
toast->stopTimer(); toast->stopTimer();
toast->setIsHidden(true); toast->setIsHidden(true);
m_toast_pool.push_back(toast); m_toast_pool.push_back(toast->getHandle());
} }
void createOverflowToast(S32 bottom, F32 timer); void createOverflowToast(S32 bottom, F32 timer);
@ -117,8 +122,8 @@ protected:
bool createPoolToast(); bool createPoolToast();
std::vector<LLToast*> m_active_toasts; toast_vec_t m_active_toasts;
std::list<LLToast*> m_toast_pool; toast_list_t m_toast_pool;
bool mStopProcessing; bool mStopProcessing;
}; };
@ -139,7 +144,7 @@ void LLNearbyChatScreenChannel::onToastFade(LLToast* toast)
if(!toast) if(!toast)
return; 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()) if(pos!=m_active_toasts.end())
m_active_toasts.erase(pos); m_active_toasts.erase(pos);
@ -166,7 +171,7 @@ bool LLNearbyChatScreenChannel::createPoolToast()
toast->setOnFadeCallback(boost::bind(&LLNearbyChatScreenChannel::onToastFade, this, _1)); toast->setOnFadeCallback(boost::bind(&LLNearbyChatScreenChannel::onToastFade, this, _1));
toast->setOnToastDestroyedCallback(boost::bind(&LLNearbyChatScreenChannel::onToastDestroyed, 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; return true;
} }
@ -184,17 +189,20 @@ void LLNearbyChatScreenChannel::addNotification(LLSD& notification)
{ {
LLUUID fromID = notification["from_id"].asUUID(); // agent id or object id LLUUID fromID = notification["from_id"].asUUID(); // agent id or object id
std::string from = notification["from"].asString(); std::string from = notification["from"].asString();
LLToast* toast = m_active_toasts[0]; LLToast* toast = m_active_toasts[0].get();
LLNearbyChatToastPanel* panel = dynamic_cast<LLNearbyChatToastPanel*>(toast->getPanel()); if (toast)
if(panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText())
{ {
panel->addMessage(notification); LLNearbyChatToastPanel* panel = dynamic_cast<LLNearbyChatToastPanel*>(toast->getPanel());
toast->reshapeToPanel();
toast->resetTimer(); if(panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText())
{
arrangeToasts(); panel->addMessage(notification);
return; 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 //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(); m_toast_pool.pop_back();
@ -235,25 +243,36 @@ void LLNearbyChatScreenChannel::addNotification(LLSD& notification)
toast->reshapeToPanel(); toast->reshapeToPanel();
toast->resetTimer(); toast->resetTimer();
m_active_toasts.push_back(toast); m_active_toasts.push_back(toast->getHandle());
arrangeToasts(); arrangeToasts();
} }
void LLNearbyChatScreenChannel::arrangeToasts() void LLNearbyChatScreenChannel::arrangeToasts()
{ {
if(m_active_toasts.size() == 0 || isHovering()) if(!isHovering())
return; {
showToastsBottom();
}
hideToastsFromScreen(); if (m_active_toasts.empty())
{
showToastsBottom(); 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 v1 = first.get()->getTimer()->getEventTimer().getElapsedTimeF32();
F32 v2 = second->getTimer()->getEventTimer().getElapsedTimeF32(); F32 v2 = second.get()->getTimer()->getEventTimer().getElapsedTimeF32();
return v1 < v2; return v1 < v2;
} }
@ -271,20 +290,22 @@ void LLNearbyChatScreenChannel::showToastsBottom()
//calc max visible item and hide other toasts. //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()) if(toast_top > gFloaterView->getRect().getHeight())
{ {
while(it!=m_active_toasts.end()) while(it!=m_active_toasts.end())
{ {
addToToastPool((*it)); addToToastPool(it->get());
it=m_active_toasts.erase(it); it=m_active_toasts.erase(it);
} }
break; break;
} }
LLToast* toast = (*it);
toast_rect = toast->getRect(); toast_rect = toast->getRect();
toast_rect.setLeftTopAndSize(getRect().mLeft , bottom + toast_rect.getHeight(), toast_rect.getWidth() ,toast_rect.getHeight()); 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 // 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); LLToast* toast = it->get();
toast->setIsHidden(false); if (toast)
toast->setVisible(TRUE); {
toast->setIsHidden(false);
toast->setVisible(TRUE);
}
} }
} }
void LLNearbyChatScreenChannel::reshape (S32 width, S32 height, BOOL called_from_parent) 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) if(chat_msg.mMuted == TRUE)
return; 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()) if(chat_msg.mText.empty())
return;//don't process empty messages 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() ; notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ;
channel->addNotification(notification); 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) void LLNearbyChatHandler::onDeleteToast(LLToast* toast)

View File

@ -43,7 +43,7 @@ LLPanelAvatarTag::LLPanelAvatarTag(const LLUUID& key, const std::string im_time)
, mAvatarId(LLUUID::null) , mAvatarId(LLUUID::null)
// , mFadeTimer() // , mFadeTimer()
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_tag.xml"); buildPanel(this, "panel_avatar_tag.xml");
setLeftButtonClickCallback(boost::bind(&LLPanelAvatarTag::onClick, this)); setLeftButtonClickCallback(boost::bind(&LLPanelAvatarTag::onClick, this));
setAvatarId(key); setAvatarId(key);
setTime(im_time); setTime(im_time);

View File

@ -144,7 +144,7 @@ LLPanelClassifiedInfo::~LLPanelClassifiedInfo()
LLPanelClassifiedInfo* LLPanelClassifiedInfo::create() LLPanelClassifiedInfo* LLPanelClassifiedInfo::create()
{ {
LLPanelClassifiedInfo* panel = new LLPanelClassifiedInfo(); LLPanelClassifiedInfo* panel = new LLPanelClassifiedInfo();
LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_classified_info.xml"); buildPanel(panel, "panel_classified_info.xml");
return panel; return panel;
} }
@ -617,7 +617,7 @@ LLPanelClassifiedEdit::~LLPanelClassifiedEdit()
LLPanelClassifiedEdit* LLPanelClassifiedEdit::create() LLPanelClassifiedEdit* LLPanelClassifiedEdit::create()
{ {
LLPanelClassifiedEdit* panel = new LLPanelClassifiedEdit(); LLPanelClassifiedEdit* panel = new LLPanelClassifiedEdit();
LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_edit_classified.xml"); buildPanel(panel, "panel_edit_classified.xml");
return panel; return panel;
} }

View File

@ -42,7 +42,7 @@ LLPanelGenericTip::LLPanelGenericTip(
const LLNotificationPtr& notification) : const LLNotificationPtr& notification) :
LLPanelTipToast(notification) LLPanelTipToast(notification)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_generic_tip.xml"); buildPanel(this, "panel_generic_tip.xml");
getChild<LLUICtrl>("message")->setValue(notification->getMessage()); getChild<LLUICtrl>("message")->setValue(notification->getMessage());

View File

@ -375,7 +375,7 @@ LLPanelGroupInvite::LLPanelGroupInvite(const LLUUID& group_id)
mPendingUpdate(FALSE) mPendingUpdate(FALSE)
{ {
// Pass on construction of this panel to the control factory. // 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() LLPanelGroupInvite::~LLPanelGroupInvite()

View File

@ -202,7 +202,7 @@ LLLandmarksPanel::LLLandmarksPanel()
mInventoryObserver = new LLLandmarksPanelObserver(this); mInventoryObserver = new LLLandmarksPanelObserver(this);
gInventory.addObserver(mInventoryObserver); gInventory.addObserver(mInventoryObserver);
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_landmarks.xml"); buildPanel(this, "panel_landmarks.xml");
} }
LLLandmarksPanel::~LLLandmarksPanel() LLLandmarksPanel::~LLLandmarksPanel()

View File

@ -193,7 +193,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
// Logo // Logo
mLogoImage = LLUI::getUIImage("startup_logo"); mLogoImage = LLUI::getUIImage("startup_logo");
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); buildPanel(this, "panel_login.xml");
#if USE_VIEWER_AUTH #if USE_VIEWER_AUTH
//leave room for the login menu bar //leave room for the login menu bar

View File

@ -168,7 +168,7 @@ void LLPanelMe::onCancelClicked()
LLPanelMyProfileEdit::LLPanelMyProfileEdit() LLPanelMyProfileEdit::LLPanelMyProfileEdit()
: LLPanelMyProfile() : LLPanelMyProfile()
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_edit_profile.xml"); buildPanel(this, "panel_edit_profile.xml");
setAvatarId(gAgent.getID()); setAvatarId(gAgent.getID());
} }

View File

@ -80,7 +80,7 @@ LLPanelMediaSettingsGeneral::LLPanelMediaSettingsGeneral() :
mMediaEditable(false) mMediaEditable(false)
{ {
// build dialog from XML // build dialog from XML
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_media_settings_general.xml"); buildPanel(this, "panel_media_settings_general.xml");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -65,7 +65,7 @@ LLPanelMediaSettingsPermissions::LLPanelMediaSettingsPermissions() :
mPermsWorldControl( 0 ) mPermsWorldControl( 0 )
{ {
// build dialog from XML // build dialog from XML
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_media_settings_permissions.xml"); buildPanel(this, "panel_media_settings_permissions.xml");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -59,7 +59,7 @@ LLPanelMediaSettingsSecurity::LLPanelMediaSettingsSecurity() :
mCommitCallbackRegistrar.add("Media.whitelistDelete", boost::bind(&LLPanelMediaSettingsSecurity::onBtnDel, this)); mCommitCallbackRegistrar.add("Media.whitelistDelete", boost::bind(&LLPanelMediaSettingsSecurity::onBtnDel, this));
// build dialog from XML // build dialog from XML
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_media_settings_security.xml"); buildPanel(this, "panel_media_settings_security.xml");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -102,7 +102,7 @@ LLPanelNearByMedia::LLPanelNearByMedia()
mCommitCallbackRegistrar.add("SelectedMediaCtrl.Zoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaZoom, this)); mCommitCallbackRegistrar.add("SelectedMediaCtrl.Zoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaZoom, this));
mCommitCallbackRegistrar.add("SelectedMediaCtrl.Unzoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaUnzoom, 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() LLPanelNearByMedia::~LLPanelNearByMedia()

View File

@ -41,7 +41,7 @@ LLPanelOnlineStatus::LLPanelOnlineStatus(
LLPanelTipToast(notification) LLPanelTipToast(notification)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, buildPanel(this,
"panel_online_status_toast.xml"); "panel_online_status_toast.xml");

View File

@ -491,7 +491,7 @@ BOOL LLPanelOutfitEdit::postBuild()
setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this, _2)); 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->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this));
mCOFWearables->getCOFCallbacks().mAddWearable = boost::bind(&LLPanelOutfitEdit::onAddWearableClicked, this); mCOFWearables->getCOFCallbacks().mAddWearable = boost::bind(&LLPanelOutfitEdit::onAddWearableClicked, this);

View File

@ -307,10 +307,10 @@ bool LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
void LLPanelOutfitsInventory::initTabPanels() void LLPanelOutfitsInventory::initTabPanels()
{ {
mCurrentOutfitPanel = getChild<LLPanelWearing>(COF_TAB_NAME); mCurrentOutfitPanel = findChild<LLPanelWearing>(COF_TAB_NAME);
mCurrentOutfitPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this)); 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)); mMyOutfitsPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
mAppearanceTabs = getChild<LLTabContainer>("appearance_tabs"); mAppearanceTabs = getChild<LLTabContainer>("appearance_tabs");

View File

@ -80,7 +80,7 @@
LLPanelPickInfo* LLPanelPickInfo::create() LLPanelPickInfo* LLPanelPickInfo::create()
{ {
LLPanelPickInfo* panel = new LLPanelPickInfo(); LLPanelPickInfo* panel = new LLPanelPickInfo();
LLUICtrlFactory::getInstance()->buildPanel(panel, XML_PANEL_PICK_INFO); buildPanel(panel, XML_PANEL_PICK_INFO);
return panel; return panel;
} }
@ -350,7 +350,7 @@ void LLPanelPickInfo::onClickBack()
LLPanelPickEdit* LLPanelPickEdit::create() LLPanelPickEdit* LLPanelPickEdit::create()
{ {
LLPanelPickEdit* panel = new LLPanelPickEdit(); LLPanelPickEdit* panel = new LLPanelPickEdit();
LLUICtrlFactory::getInstance()->buildPanel(panel, XML_PANEL_EDIT_PICK); buildPanel(panel, XML_PANEL_EDIT_PICK);
return panel; return panel;
} }

View File

@ -1045,7 +1045,7 @@ LLPickItem::LLPickItem()
, mSnapshotID(LLUUID::null) , mSnapshotID(LLUUID::null)
, mNeedData(true) , mNeedData(true)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this,"panel_pick_list_item.xml"); buildPanel(this,"panel_pick_list_item.xml");
} }
LLPickItem::~LLPickItem() LLPickItem::~LLPickItem()
@ -1175,7 +1175,7 @@ LLClassifiedItem::LLClassifiedItem(const LLUUID& avatar_id, const LLUUID& classi
, mAvatarId(avatar_id) , mAvatarId(avatar_id)
, mClassifiedId(classified_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()->addObserver(getAvatarId(), this);
LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId()); LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId());

View File

@ -252,7 +252,7 @@ LLPanelPlaces::LLPanelPlaces()
LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback( LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(
boost::bind(&LLPanelPlaces::updateVerbs, this)); 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() LLPanelPlaces::~LLPanelPlaces()
@ -327,8 +327,8 @@ BOOL LLPanelPlaces::postBuild()
mFilterEditor->setCommitCallback(boost::bind(&LLPanelPlaces::onFilterEdit, this, _2, false)); mFilterEditor->setCommitCallback(boost::bind(&LLPanelPlaces::onFilterEdit, this, _2, false));
} }
mPlaceProfile = getChild<LLPanelPlaceProfile>("panel_place_profile"); mPlaceProfile = findChild<LLPanelPlaceProfile>("panel_place_profile");
mLandmarkInfo = getChild<LLPanelLandmarkInfo>("panel_landmark_info"); mLandmarkInfo = findChild<LLPanelLandmarkInfo>("panel_landmark_info");
if (!mPlaceProfile || !mLandmarkInfo) if (!mPlaceProfile || !mLandmarkInfo)
return FALSE; return FALSE;

View File

@ -119,7 +119,7 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
mCommitCallbackRegistrar.add("MediaCtrl.SkipBack", boost::bind(&LLPanelPrimMediaControls::onClickSkipBack, this)); mCommitCallbackRegistrar.add("MediaCtrl.SkipBack", boost::bind(&LLPanelPrimMediaControls::onClickSkipBack, this));
mCommitCallbackRegistrar.add("MediaCtrl.SkipForward", boost::bind(&LLPanelPrimMediaControls::onClickSkipForward, 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(); mInactivityTimer.reset();
mFadeTimer.stop(); mFadeTimer.stop();
mCurrentZoom = ZOOM_NONE; mCurrentZoom = ZOOM_NONE;

View File

@ -133,11 +133,11 @@ BOOL LLPanelProfile::postBuild()
getTabCtrl()->setCommitCallback(boost::bind(&LLPanelProfile::onTabSelected, this, _2)); 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); panel_picks->setProfilePanel(this);
getTabContainer()[PANEL_PICKS] = panel_picks; getTabContainer()[PANEL_PICKS] = panel_picks;
getTabContainer()[PANEL_PROFILE] = getChild<LLPanelAvatarProfile>(PANEL_PROFILE); getTabContainer()[PANEL_PROFILE] = findChild<LLPanelAvatarProfile>(PANEL_PROFILE);
return TRUE; return TRUE;
} }

View File

@ -120,7 +120,7 @@ BOOL LLPanelProfileView::postBuild()
{ {
LLPanelProfile::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 //*TODO remove this, according to style guide we don't use status combobox
getTabContainer()[PANEL_PROFILE]->getChildView("online_me_status_text")->setVisible( FALSE); getTabContainer()[PANEL_PROFILE]->getChildView("online_me_status_text")->setVisible( FALSE);

View File

@ -131,7 +131,7 @@ LLTeleportHistoryFlatItem::LLTeleportHistoryFlatItem(S32 index, LLTeleportHistor
mRegionName(region_name), mRegionName(region_name),
mHighlight(hl) mHighlight(hl)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history_item.xml"); buildPanel(this, "panel_teleport_history_item.xml");
} }
LLTeleportHistoryFlatItem::~LLTeleportHistoryFlatItem() LLTeleportHistoryFlatItem::~LLTeleportHistoryFlatItem()
@ -382,7 +382,7 @@ LLTeleportHistoryPanel::LLTeleportHistoryPanel()
mLastSelectedFlatlList(NULL), mLastSelectedFlatlList(NULL),
mLastSelectedItemIndex(-1) mLastSelectedItemIndex(-1)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history.xml"); buildPanel(this, "panel_teleport_history.xml");
} }
LLTeleportHistoryPanel::~LLTeleportHistoryPanel() LLTeleportHistoryPanel::~LLTeleportHistoryPanel()

View File

@ -72,7 +72,7 @@ LLPanelTopInfoBar::LLPanelTopInfoBar(): mParcelChangedObserver(0)
LLUICtrl::CommitCallbackRegistry::currentRegistrar() LLUICtrl::CommitCallbackRegistry::currentRegistrar()
.add("TopInfoBar.Action", boost::bind(&LLPanelTopInfoBar::onContextMenuItemClicked, this, _2)); .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() LLPanelTopInfoBar::~LLPanelTopInfoBar()

View File

@ -60,7 +60,7 @@ LLPanelVolumePulldown::LLPanelVolumePulldown()
mCommitCallbackRegistrar.add("Vol.setControlFalse", boost::bind(&LLPanelVolumePulldown::setControlFalse, this, _2)); mCommitCallbackRegistrar.add("Vol.setControlFalse", boost::bind(&LLPanelVolumePulldown::setControlFalse, this, _2));
mCommitCallbackRegistrar.add("Vol.GoAudioPrefs", boost::bind(&LLPanelVolumePulldown::onAdvancedButtonClick, 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() BOOL LLPanelVolumePulldown::postBuild()

View File

@ -62,7 +62,7 @@ LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_param
mAllowModify(allow_modify), mAllowModify(allow_modify),
mWearable(wearable) 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. // *HACK To avoid hard coding texture position, lets use border's position for texture.
LLViewBorder* left_border = getChild<LLViewBorder>("left_border"); LLViewBorder* left_border = getChild<LLViewBorder>("left_border");

View File

@ -56,7 +56,7 @@ LLSidepanelInventory::LLSidepanelInventory()
mPanelMainInventory(NULL) mPanelMainInventory(NULL)
{ {
//LLUICtrlFactory::getInstance()->buildPanel(this, "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() //buildPanel(this, "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
} }
LLSidepanelInventory::~LLSidepanelInventory() LLSidepanelInventory::~LLSidepanelInventory()
@ -90,7 +90,7 @@ BOOL LLSidepanelInventory::postBuild()
mOverflowBtn = mInventoryPanel->getChild<LLButton>("overflow_btn"); mOverflowBtn = mInventoryPanel->getChild<LLButton>("overflow_btn");
mOverflowBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onOverflowButtonClicked, this)); 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)); mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2));
LLTabContainer* tabs = mPanelMainInventory->getChild<LLTabContainer>("inventory filter tabs"); LLTabContainer* tabs = mPanelMainInventory->getChild<LLTabContainer>("inventory filter tabs");
tabs->setCommitCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this)); tabs->setCommitCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));
@ -108,7 +108,7 @@ BOOL LLSidepanelInventory::postBuild()
// UI elements from item panel // 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"); LLButton* back_btn = mItemPanel->getChild<LLButton>("back_btn");
back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this)); back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this));
@ -116,7 +116,7 @@ BOOL LLSidepanelInventory::postBuild()
// UI elements from task panel // UI elements from task panel
{ {
mTaskPanel = getChild<LLSidepanelTaskInfo>("sidepanel__task_panel"); mTaskPanel = findChild<LLSidepanelTaskInfo>("sidepanel__task_panel");
if (mTaskPanel) if (mTaskPanel)
{ {
LLButton* back_btn = mTaskPanel->getChild<LLButton>("back_btn"); LLButton* back_btn = mTaskPanel->getChild<LLButton>("back_btn");
@ -176,7 +176,7 @@ void LLSidepanelInventory::onShopButtonClicked()
void LLSidepanelInventory::performActionOnSelection(const std::string &action) 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(); LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item) if (!current_item)
{ {
@ -314,7 +314,7 @@ void LLSidepanelInventory::updateVerbs()
bool LLSidepanelInventory::canShare() bool LLSidepanelInventory::canShare()
{ {
LLPanelMainInventory* panel_main_inventory = LLPanelMainInventory* panel_main_inventory =
mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory"); mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory");
LLFolderView* root_folder = LLFolderView* root_folder =
panel_main_inventory->getActivePanel()->getRootFolder(); panel_main_inventory->getActivePanel()->getRootFolder();
@ -332,7 +332,7 @@ bool LLSidepanelInventory::canShare()
LLInventoryItem *LLSidepanelInventory::getSelectedItem() 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(); LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item) if (!current_item)
{ {
@ -345,7 +345,7 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem()
U32 LLSidepanelInventory::getSelectedCount() 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(); std::set<LLUUID> selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList();
return selection_list.size(); return selection_list.size();
} }

View File

@ -142,7 +142,7 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
mBalanceTimer = new LLFrameTimer(); mBalanceTimer = new LLFrameTimer();
mHealthTimer = new LLFrameTimer(); mHealthTimer = new LLFrameTimer();
LLUICtrlFactory::getInstance()->buildPanel(this,"panel_status_bar.xml"); buildPanel(this,"panel_status_bar.xml");
} }
LLStatusBar::~LLStatusBar() LLStatusBar::~LLStatusBar()

View File

@ -44,7 +44,7 @@ LLSysWellItem::LLSysWellItem(const Params& p) : LLPanel(p),
mTitle(NULL), mTitle(NULL),
mCloseBtn(NULL) mCloseBtn(NULL)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_sys_well_item.xml"); buildPanel(this, "panel_sys_well_item.xml");
mTitle = getChild<LLTextBox>("title"); mTitle = getChild<LLTextBox>("title");
mCloseBtn = getChild<LLButton>("close_btn"); mCloseBtn = getChild<LLButton>("close_btn");

View File

@ -255,7 +255,7 @@ LLIMWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID&
S32 chicletCounter, const std::string& name, const LLUUID& otherParticipantId) : S32 chicletCounter, const std::string& name, const LLUUID& otherParticipantId) :
LLPanel(LLPanel::Params()), mChiclet(NULL), mParent(parent) 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. // Choose which of the pre-created chiclets (IM/group) to use.
// The other one gets hidden. // The other one gets hidden.
@ -352,7 +352,7 @@ LLIMWellWindow::ObjectRowPanel::ObjectRowPanel(const LLUUID& notification_id, bo
: LLPanel() : LLPanel()
, mChiclet(NULL) , mChiclet(NULL)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_active_object_row.xml", NULL); buildPanel(this, "panel_active_object_row.xml", NULL);
initChiclet(notification_id); initChiclet(notification_id);

View File

@ -194,6 +194,8 @@ public:
virtual S32 notifyParent(const LLSD& info); virtual S32 notifyParent(const LLSD& info);
LLHandle<LLToast> getHandle() { mHandle.bind(this); return mHandle; }
private: private:
void onToastMouseEnter(); void onToastMouseEnter();
@ -206,6 +208,8 @@ private:
LLUUID mSessionID; LLUUID mSessionID;
LLNotificationPtr mNotification; LLNotificationPtr mNotification;
LLRootHandle<LLToast> mHandle;
LLPanel* mWrapperPanel; LLPanel* mWrapperPanel;
// timer counts a lifetime of a toast // timer counts a lifetime of a toast

View File

@ -60,7 +60,7 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(LLNotificationPtr& notification
: LLToastPanel(notification), : LLToastPanel(notification),
mInventoryOffer(NULL) mInventoryOffer(NULL)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group_notify.xml"); buildPanel(this, "panel_group_notify.xml");
const LLSD& payload = notification->getPayload(); const LLSD& payload = notification->getPayload();
LLGroupData groupData; LLGroupData groupData;
if (!gAgent.getGroupData(payload["group_id"].asUUID(),groupData)) if (!gAgent.getGroupData(payload["group_id"].asUUID(),groupData))

View File

@ -51,7 +51,7 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif
mAvatarIcon(NULL), mAvatarName(NULL), mAvatarIcon(NULL), mAvatarName(NULL),
mTime(NULL), mMessage(NULL), mGroupIcon(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"); mGroupIcon = getChild<LLGroupIconCtrl>("group_icon");
mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon"); mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon");

View File

@ -67,7 +67,7 @@ mNumButtons(0),
mAddedDefaultBtn(false), mAddedDefaultBtn(false),
mCloseNotificationOnDestroy(true) mCloseNotificationOnDestroy(true)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_notification.xml"); buildPanel(this, "panel_notification.xml");
if(rect != LLRect::null) if(rect != LLRect::null)
{ {
this->setShape(rect); this->setShape(rect);

View File

@ -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 // (But wait to add it as a child of the root view so that it will be in front of the
// other views.) // other views.)
MainPanel* main_view = new MainPanel(); 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); main_view->setShape(full_window);
getRootView()->addChild(main_view); getRootView()->addChild(main_view);
@ -1529,7 +1529,7 @@ void LLViewerWindow::initBase()
mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle(); mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle();
mNonSideTrayView = main_view->getChildView("non_side_tray_view")->getHandle(); mNonSideTrayView = main_view->getChildView("non_side_tray_view")->getHandle();
mFloaterViewHolder = main_view->getChildView("floater_view_holder")->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(); mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle();
// Constrain floaters to inside the menu and status bar regions. // Constrain floaters to inside the menu and status bar regions.
@ -1568,7 +1568,7 @@ void LLViewerWindow::initBase()
LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLFloaterPreference::initBusyResponse)); LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLFloaterPreference::initBusyResponse));
// Add the progress bar view (startup view), which overrides everything // Add the progress bar view (startup view), which overrides everything
mProgressView = getRootView()->getChild<LLProgressView>("progress_view"); mProgressView = getRootView()->findChild<LLProgressView>("progress_view");
setShowProgress(FALSE); setShowProgress(FALSE);
setProgressCancelButtonVisible(FALSE); setProgressCancelButtonVisible(FALSE);