The Octopus Feature

___
                     .-'   `'.
                    /         \
                    |         ;
                    |         |           ___.--,
           _.._     |0) ~ (0) |    _.---'`__.-( (_.
    __.--'`_.. '.__.\    '--. \_.-' ,.--'`     `""`
   ( ,.--'`   ',__ /./;   ;, '.__.'`    __
   _`) )  .---.__.' / |   |\   \__..--""  """--.,_
  `---' .'.''-._.-'`_./  /\ '.  \ _.-~~~````~~~-._`-.__.'
        | |  .' _.-' |  |  \  \  '.               `~---`
         \ \/ .'     \  \   '. '-._)
          \/ /        \  \    `=.__`~-.
     jgs  / /\         `) )    / / `"".`\
    , _.-'.'\ \        / /    ( (     / /
     `--~`   ) )    .-'.'      '.'.  | (
            (/`    ( (`          ) )  '-;
             `      '-;         (-'
This commit is contained in:
Siana Gearz
2011-03-24 23:54:23 +01:00
parent d4b6ece24b
commit 179f4ddabb
21 changed files with 1277 additions and 124 deletions

View File

@@ -225,6 +225,16 @@ bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNo
}
bool LLUICtrlFactory::getLayeredXMLNodeFromBuffer(const std::string &buffer, LLXMLNodePtr& root)
{
if (!LLXMLNode::parseBuffer(buffer.data(), buffer.size(), root, 0)) {
llwarns << "Error reading UI description from buffer." << llendl;
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// buildFloater()
//-----------------------------------------------------------------------------
@@ -238,6 +248,23 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen
return;
}
buildFloaterInternal(floaterp, root, filename, factory_map, open);
}
void LLUICtrlFactory::buildFloaterFromBuffer(LLFloater *floaterp, const std::string &buffer,
const LLCallbackMap::map_t *factory_map, BOOL open) /* Flawfinder: ignore */
{
LLXMLNodePtr root;
if (!LLUICtrlFactory::getLayeredXMLNodeFromBuffer(buffer, root))
return;
buildFloaterInternal(floaterp, root, "(buffer)", factory_map, open);
}
void LLUICtrlFactory::buildFloaterInternal(LLFloater *floaterp, LLXMLNodePtr &root, const std::string &filename,
const LLCallbackMap::map_t *factory_map, BOOL open) /* Flawfinder: ignore */
{
// root must be called floater
if( !(root->hasName("floater") || root->hasName("multi_floater") ) )
{
@@ -294,13 +321,31 @@ S32 LLUICtrlFactory::saveToXML(LLView* viewp, const std::string& filename)
BOOL LLUICtrlFactory::buildPanel(LLPanel* panelp, const std::string& filename,
const LLCallbackMap::map_t* factory_map)
{
BOOL didPost = FALSE;
LLXMLNodePtr root;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
return didPost;
return FALSE;
}
return buildPanelInternal(panelp, root, filename, factory_map);
}
BOOL LLUICtrlFactory::buildPanelFromBuffer(LLPanel *panelp, const std::string &buffer,
const LLCallbackMap::map_t* factory_map)
{
LLXMLNodePtr root;
if (!LLUICtrlFactory::getLayeredXMLNodeFromBuffer(buffer, root))
return FALSE;
return buildPanelInternal(panelp, root, "(buffer)", factory_map);
}
BOOL LLUICtrlFactory::buildPanelInternal(LLPanel* panelp, LLXMLNodePtr &root, const std::string &filename,
const LLCallbackMap::map_t* factory_map)
{
BOOL didPost = FALSE;
// root must be called panel
if( !root->hasName("panel" ) )

View File

@@ -53,8 +53,12 @@ public:
void buildFloater(LLFloater* floaterp, const std::string &filename,
const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE);
void buildFloaterFromBuffer(LLFloater *floaterp, const std::string &buffer,
const LLCallbackMap::map_t *factory_map = NULL, BOOL open = TRUE);
BOOL buildPanel(LLPanel* panelp, const std::string &filename,
const LLCallbackMap::map_t* factory_map = NULL);
BOOL buildPanelFromBuffer(LLPanel *panelp, const std::string &buffer,
const LLCallbackMap::map_t* factory_map = NULL);
void removePanel(LLPanel* panelp) { mBuiltPanels.erase(panelp->getHandle()); }
void removeFloater(LLFloater* floaterp) { mBuiltFloaters.erase(floaterp->getHandle()); }
@@ -77,6 +81,7 @@ public:
virtual LLView* createWidget(LLPanel *parent, LLXMLNodePtr node);
static bool getLayeredXMLNode(const std::string &filename, LLXMLNodePtr& root);
static bool getLayeredXMLNodeFromBuffer(const std::string &buffer, LLXMLNodePtr& root);
static const std::vector<std::string>& getXUIPaths();
@@ -94,6 +99,11 @@ private:
static std::vector<std::string> sXUIPaths;
LLPanel* mDummyPanel;
void buildFloaterInternal(LLFloater *floaterp, LLXMLNodePtr &root, const std::string &filename,
const LLCallbackMap::map_t *factory_map, BOOL open);
BOOL buildPanelInternal(LLPanel* panelp, LLXMLNodePtr &root, const std::string &filename,
const LLCallbackMap::map_t* factory_map = NULL);
};