void export_test_floaters() { // Convert all test floaters to new XML format std::string delim = gDirUtilp->getDirDelimiter(); std::string xui_dir = get_xui_dir() + "en" + delim; std::string filename; LLDirIterator iter(xui_dir, "floater_test_*.xml"); while (iter.next(filename)) { if (filename.find("_new.xml") != std::string::npos) { // don't re-export other test floaters continue; } llinfos << "Converting " << filename << llendl; // Build a floater and output new attributes LLXMLNodePtr output_node = new LLXMLNode(); LLFloater* floater = new LLFloater(LLSD()); floater->buildFromFile( filename, // FALSE, // don't open floater output_node); std::string out_filename = xui_dir + filename; std::string::size_type extension_pos = out_filename.rfind(".xml"); out_filename.resize(extension_pos); out_filename += "_new.xml"; llinfos << "Output: " << out_filename << llendl; LLFILE* floater_file = LLFile::fopen(out_filename.c_str(), "w"); LLXMLNode::writeHeaderToFile(floater_file); output_node->writeToFile(floater_file); fclose(floater_file); } }
//static LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) { LLFloater* res = findInstance(name, key); if (!res) { const LLFloaterBuildFunc& build_func = sBuildMap[name].mFunc; // const std::string& xui_file = sBuildMap[name].mFile; // [SL:KB] - Patch: UI-Base | Checked: 2010-12-01 (Catznip-3.0.0a) | Added: Catznip-2.5.0a const std::string& xui_file = (!sBuildMap[name].mFileFunc) ? sBuildMap[name].mFile : sBuildMap[name].mFileFunc(); // [/SL:KB] if (build_func) { const std::string& groupname = sGroupMap[name]; if (!groupname.empty()) { instance_list_t& list = sInstanceMap[groupname]; res = build_func(key); if (!res) { LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL; return NULL; } bool success = res->buildFromFile(xui_file); if (!success) { LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL; return NULL; } // Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe if (res->mKey.isUndefined()) { res->mKey = key; } res->setInstanceName(name); LLFloater *last_floater = (list.empty() ? NULL : list.back()); res->applyControlsAndPosition(last_floater); gFloaterView->adjustToFitScreen(res, false); list.push_back(res); } } if (!res) { LL_WARNS() << "Floater type: '" << name << "' not registered." << LL_ENDL; } } return res; }
//static LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) { LLFloater* res = findInstance(name, key); if (!res) { const LLFloaterBuildFunc& build_func = sBuildMap[name].mFunc; const std::string& xui_file = sBuildMap[name].mFile; if (build_func) { const std::string& groupname = sGroupMap[name]; if (!groupname.empty()) { instance_list_t& list = sInstanceMap[groupname]; int index = list.size(); res = build_func(key); bool success = res->buildFromFile(xui_file, NULL); if (!success) { llwarns << "Failed to build floater type: '" << name << "'." << llendl; return NULL; } // Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe res->mKey = key; res->setInstanceName(name); res->applySavedVariables(); // Can't apply rect and dock state until setting instance name if (res->mAutoTile && !res->getHost() && index > 0) { const LLRect& cur_rect = res->getRect(); LLRect next_rect = getFloaterRect(groupname); next_rect.setLeftTopAndSize(next_rect.mLeft, next_rect.mTop, cur_rect.getWidth(), cur_rect.getHeight()); res->setRect(next_rect); res->setRectControl(LLStringUtil::null); // don't save rect of tiled floaters gFloaterView->adjustToFitScreen(res, true); } else { gFloaterView->adjustToFitScreen(res, false); } list.push_back(res); } } if (!res) { llwarns << "Floater type: '" << name << "' not registered." << llendl; } } return res; }
//static LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) { LLFloater* res = findInstance(name, key); if (!res) { const LLFloaterBuildFunc& build_func = sBuildMap[name].mFunc; const std::string& xui_file = sBuildMap[name].mFile; if (build_func) { const std::string& groupname = sGroupMap[name]; if (!groupname.empty()) { instance_list_t& list = sInstanceMap[groupname]; int index = list.size(); res = build_func(key); bool success = res->buildFromFile(xui_file, NULL); if (!success) { llwarns << "Failed to build floater type: '" << name << "'." << llendl; return NULL; } // Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe res->mKey = key; res->setInstanceName(name); // AO: Mark certain floaters (sidebar tab floaters) as needing to be pseudo-hidden on minimization. // At the moment we flag this pseudo hiding with the presence of a dummy control in floater_side_bar_tab.xml // and the name of the floater window. This should be refactored into a floater attribute. llinfos << "trying to restore variables for name: " << name << llendl; std::string pat = "side_bar_tab"; size_t found = name.find(pat); if (found!=std::string::npos) { if (!res->hasChild("showMinimized")) res->setHideOnMinimize(true); } res->applySavedVariables(); // Can't apply rect and dock state until setting instance name if (res->mAutoTile && !res->getHost() && index > 0) { const LLRect& cur_rect = res->getRect(); LLRect next_rect = getFloaterRect(groupname); next_rect.setLeftTopAndSize(next_rect.mLeft, next_rect.mTop, cur_rect.getWidth(), cur_rect.getHeight()); res->setRect(next_rect); res->setRectControl(LLStringUtil::null); // don't save rect of tiled floaters gFloaterView->adjustToFitScreen(res, true); } else { gFloaterView->adjustToFitScreen(res, false); } list.push_back(res); } } if (!res) { llwarns << "Floater type: '" << name << "' not registered." << llendl; } } return res; }